//
//  JumpViewController.swift
//  新闻
//
//  Created by 芮京 on 2018/12/12.
//  Copyright © 2018 芮京. All rights reserved.
//

import UIKit
import AVFoundation
class JumpViewController: UIViewController {
    var strr:String = ""
    var playeritem:AVPlayerItem?
    var player : AVPlayer?
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
    self.view.backgroundColor = UIColor.white

        //创建媒体资源管理对象
        self.playeritem = AVPlayerItem(url: NSURL(string: strr)! as URL)
        //创建ACplayer：负责视频播放
        self.player = AVPlayer.init(playerItem: self.playeritem)
        self.player?.rate = 1.0//播放速度 播放前设置
        //创建显示视频的图层
        let play = AVPlayerLayer.init(player: self.player)
        play.videoGravity = .resizeAspect
        play.frame = self.view.bounds
        self.view.layer.addSublayer(play)
        //播放
        self.player?.play()

    }
    //隐藏导航条
    override func viewWillAppear(_ animated: Bool) {
        self.tabBarController?.tabBar.isHidden = true
    }
    override func viewWillDisappear(_ animated: Bool) {
        self.tabBarController?.tabBar.isHidden = false
    }

}
